//
//  LoginUser.m
//  singledemo
//
//  Created by zhouxiaobo on 15/10/27.
//  Copyright © 2015年 mapath. All rights reserved.
//

#import "LoginUser.h"

@implementation LoginUser

static LoginUser *loginUser = nil;

@synthesize name = _name;

//+(LoginUser *)shardedLoginUser{
//    @synchronized(self){  //线程加锁
//        if (loginUser == nil){
//            loginUser = [[[self class]alloc]init];
//        }
//    }
//    return loginUser;
//}

+(LoginUser *)shardedLoginUser{
    static dispatch_once_t oneToken;    //只执行一次
    dispatch_once(&oneToken, ^{
        loginUser = [[[self class]alloc]init];
    });
    return loginUser;

}

-(id)init{
    self = [super init];
    if(self){
        self.name = @"zxb";
    }
    return self;
}


@end
